package com.allwees.bs.module.oms.rest;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.allwees.bs.module.core.rest.BoCrudApi;
import com.allwees.bs.module.oms.entity.OmsOrder;
import com.allwees.bs.module.oms.entity.OmsOrderItem;
import com.allwees.bs.module.oms.service.BaseOmsOrderService;
import org.springframework.web.bind.annotation.RestController;

/**
 * base oms order api
 *
 * @author mouhaining
 * @since 2020-03-02 13:53
 */
@RestController
public abstract class BaseOmsOrderApi<Service extends BaseOmsOrderService> extends BoCrudApi<OmsOrder, Service> {

    protected <T> void afterFindPage(IPage<T> page) {
        page.getRecords().forEach(o ->{
           OmsOrder omsOrder = (OmsOrder)o;
            omsOrder.setOriginalAmtProduct(omsOrder.getAmtProductAfterAdd());
            omsOrder.setOriginalAmtShipping(omsOrder.getAmtShippingAfterAdd());
        });
    }
}
